<?php

namespace app\admin\model\dahuinew;

use think\Model;

class Dljzyw extends Model
{
    // 表名
    protected $name = 'dahuinew_dljzyw';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

    // 定义时间戳字段名
    protected $createTime = false;
    protected $updateTime = false;
    
    // 追加属性
    protected $append = [
        'shuiz_text',
        'kpyw_text',
        'isxy_text'
    ];
    

    
    public function getShuizList()
    {
        return ['小规模' => __('小规模'),'一般纳税人' => __('一般纳税人')];
    }     

    public function getKpywList()
    {
        return ['包年' => __('包年'),'否' => __('否'),'包数量' => __('包数量')];
    }     

    public function getIsxyList()
    {
        return ['未续约' => __('未续约'),'已续约' => __('已续约'), '停止' => __('停止')];
    }

    public function getZcztList()
    {
        return ['正常' => __('正常'),'已停止' => __('已停止')];
    }

    public function getXftypeList()
    {
        return ['新增' => __('新增'),'续费' => __('续费')];
    }

    public function getShuizTextAttr($value, $data)
    {        
        $value = $value ? $value : (isset($data['shuiz']) ? $data['shuiz'] : '');
        $list = $this->getShuizList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getKpywTextAttr($value, $data)
    {        
        $value = $value ? $value : (isset($data['kpyw']) ? $data['kpyw'] : '');
        $list = $this->getKpywList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getIsxyTextAttr($value, $data)
    {        
        $value = $value ? $value : (isset($data['isxy']) ? $data['isxy'] : '');
        $list = $this->getIsxyList();
        return isset($list[$value]) ? $list[$value] : '';
    }

    public function admin()
    {
        return $this->belongsTo('app\admin\model\Admin', 'admin_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }




}
